package club.emergency.wechat.ranking.search.consumer.service.fallback_factory;

import club.emergency.wechat.common.response.ResponseEntity;
import club.emergency.wechat.common.response.StatusCode;
import club.emergency.wechat.ranking.search.consumer.service.RankingSearchConsumer;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.ranking.search.consumer.service.fallback_factory
 * Date: 2019/3/25
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@Component
public class RankingSearchFallbackFactory implements FallbackFactory<RankingSearchConsumer> {
    @Override
    public RankingSearchConsumer create(Throwable throwable) {
        return endIndex -> ResponseEntity.error(StatusCode.REDIS_GET_ERROR, "查询排行榜信息成功失败！", throwable.getMessage());
    }
}
